#ifndef DEFINES_H
#define DEFINES_H

#include <cmath>
#include <climits>
#include <cassert>
#include <string>

#include <numeric>
#include <vector>

typedef short int16;
typedef unsigned short uint16;
typedef unsigned int uint;
typedef unsigned char byte;

const int min_int = std::numeric_limits<uint>::max();
const int max_int = std::numeric_limits<uint>::max();
const uint max_uint = std::numeric_limits<uint>::max();

const float epsilon = 0.0001f;
const float pi = M_PI;
const float infinity = std::numeric_limits<float>::infinity();

// Float equality
inline bool eql(float a, float b)
{
	return fabs(a-b) < epsilon;
}

inline float clamp(float a, float low, float high)
{
	assert(low < high);

	if(a > high) a = high;
	if(a < low) a = low;
	return a;
}

template <class T>
T lerp(const T& a, const T& b, float t)
{
	return a + ((b - a) * t);
}

template <class T>
T min(const T& a, const T& b)
{
	return a < b ? a : b;
}

template <class T>
T max(const T& a, const T& b)
{
	return a > b ? a : b;
}

#endif

